<?php
include("include/config.inc.php");
$msg = "";
if(isset($_POST['userName']) && strlen($_POST['userName']) > 0 || isset($_POST['password']) && strlen($_POST['password']) > 0)
{
	//$currentDate = date("Y-m-d"); 
	//echo "time is ".date('d-M-Y H:i',$startTime)."<BR>\n";
$checkLogin = "SELECT userName,password
                 FROM user
                WHERE userName = '".$_POST['userName']."'
                  AND password = '".$_POST['password']."'";
$checkLoginresult = mysql_query($checkLogin);
if($userLoginRow = mysql_fetch_array($checkLoginresult))
{
  $checkLogin = "SELECT userName,password
               FROM user
              WHERE userName = '".$_POST['userName']."'
                AND password = '".$_POST['password']."'";
  $checkLoginresult = mysql_query($checkLogin);
  if($userLoginRow = mysql_fetch_array($checkLoginresult))
  {                  
    $_SESSION['s_activId']   = $userLoginRow['userName'];
    //$_SESSION['s_userType']  = $userLoginRow['userType'];
    header("Location:./party.php");
  }
  else
  {
  	$msg = "Already Logged In !";
  }
}
else
{
  $msg = "Wrong Username or Password !";
}
}
include("./bottom.php");
$smarty->assign("msg",$msg);
$smarty->display("checkLogin.tpl");
?>